<template>
	<view class="order">
		<!-- 列表 -->
		<view class="listBox">
			<view class="list" v-for="(item,index) in list" :key="index"
				@tap.stop="Jump(`/pages/my/remarkMessageDetails?id=${item.id}`)">
				<view class="list_t">
					<view class="box">
						<image src="@/static/my/bell.png" mode="widthFix"></image>
						<u-text :text="item.title" lines="1" line-height="48rpx" color="#000" size="28rpx" />
					</view>
					<view class="box">
						<image src="@/static/my/time.png" mode="widthFix"></image>
						<view class="name" style="color: #B6B6B6;">{{item.createtime}}</view>
					</view>
				</view>
				<view class=""
					style="display: flex;align-items: center;width: 7%;justify-content: space-around;margin-left: 20rpx;text-align: right;">
					<u-badge :isDot="true" type="error" v-if="item.status==1" style="margin-right: 6rpx;"></u-badge>
					<u-icon name="arrow-right" size="10" color="#B6B6B6"></u-icon>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import {
		twoList
	} from "@/request/myApi.js";
	export default {
		data() {
			return {
				page: 1,
				list: [],
				isText: '',
				last_page: 1,
				type: 1,
				// status:1未读  2
			};
		},
		onLoad(e) {
			this.type = e.type
			wx.setNavigationBarTitle({
				title: this.type == 1 ? '提醒消息' : '系统公告'
			})
		},
		onReachBottom() {
			let that = this
			if (that.page < that.last_page) {
				that.page = that.page + 1
				that.getList()
			}
		},
		onShow() {
			this.list = []
			this.page = 1
			this.isText = ''
			this.getList()
		},
		methods: {
			// 跳转
			Jump(url) {
				uni.navigateTo({
					url: url
				})
			},
			// 获取订单列表
			getList() {
				let that = this
				twoList({
					type: that.type
				}).then((res) => {
					if (res.code == 200) {
						res.data.list.length == 0 ? that.isText = '暂无数据' : that.isText = ''
						that.list = that.list.concat(res.data.list)
						that.last_page = Math.ceil(res.data.count / res.data.list.length)
					} else {
						uni.showToast({
							title: res.msg,
							duration: 1500,
							icon: 'none',
						})
					}
				});
			},
		},
	}
</script>

<style lang="less">
	page {
		// background-color: #f9f9f9;
	}

	.u-tab-bar {
		display: none !important;
	}

	.chooseCup {
		margin-right: 8rpx !important;

		image {
			width: 20rpx !important;
			height: 12rpx !important;
			margin: 14rpx;
		}
	}

	.order {
		width: 100vw;

		.tabBox {
			width: 100%;
			// height: 100rpx;
		}

		.listBox {
			width: 95%;
			margin: 30rpx auto;

			.list {
				width: 100%;
				height: auto;
				padding: 20rpx;
				border-radius: 20rpx;
				background-color: #fff;
				margin: 20rpx auto;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				border-bottom: 2rpx solid rgba(217, 217, 217, 0.4);

				.code {
					color: #979797;
					font-weight: 400;
					font-size: 12px;
					line-height: 17px;
					margin-bottom: 10rpx;
				}

				.list_t {
					view {
						display: flex;
						flex: 1;
						justify-content: space-between;
						align-items: center;
					}

					.box {
						height: 50rpx;
						line-height: 50rpx;
						font-size: 30rpx;

						image {
							width: 28rpx;
							border-radius: 50%;
							margin-right: 14rpx;
						}

						.name {
							font-size: 26rpx;
						}
					}
				}

				.list_b {
					font-size: 28rpx;
					font-weight: 400;
					color: #7F8084;
					padding-top: 30rpx;

					.text {
						.money {
							display: inline-block;
							font-size: 32rpx;
							font-weight: 600;
							color: #000;
						}
					}
				}

				.btnBox {
					width: 100%;
					margin-top: 30rpx;
					flex-direction: row-reverse !important;

					.btn {
						width: 132rpx;
						height: 46rpx;
						line-height: 46rpx;
						border-radius: 46rpx;
						text-align: center;
						background-color: #000;
						color: #fff;
						font-size: 24rpx;
						font-weight: 500;
					}
				}

			}
		}
	}
</style>
